package com.tjetc.myservlet;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author gaoyongxiang
 * @version v1.0
 * @date 2025/9/1
 */
public class _2MyTomcat {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(8080);
        System.out.println("---------------tomcat启动 监听8080端口---------------");

        while (!serverSocket.isClosed()) {

            Socket socket = serverSocket.accept();

            // 创建请求处理器对象进行处理
            MyRequestHandler requestHandler = new MyRequestHandler(socket);
            // 开启线程进行处理
            new Thread(requestHandler).start();

        }
    }
}